﻿using System.Web.Mvc;
using System.Web.Routing;
using ABC.Core.Web.Routes;

namespace ABC.Web.Areas.My
{
    public class MyAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "my";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.Routes.Add(null, new LowercaseRoute(
            "my/cabinet/editobject/{id}",
            new RouteValueDictionary(new { controller = "Cabinet", action = "AddObject" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            //Clients Controller
            context.Routes.Add(null, new LowercaseRoute(
            "my/clients/page{page}",
            new RouteValueDictionary(new { controller = "Clients", action = "Index", page = UrlParameter.Optional }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/clients/objects/page{page}",
            new RouteValueDictionary(new { controller = "Clients", action = "Objects", page = UrlParameter.Optional }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/clients/client/edit/{id}",
            new RouteValueDictionary(new { controller = "Clients", action = "Add" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/clients/trash/page{page}",
            new RouteValueDictionary(new { controller = "Clients", action = "Trash" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            //Admin Controller
            context.Routes.Add(null, new LowercaseRoute(
            "my/admin/editnews/{id}",
            new RouteValueDictionary(new { controller = "Admin", action = "AddNews" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/admin/news/page{page}",
            new RouteValueDictionary(new { controller = "Admin", action = "News" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/admin/finance/page{page}",
            new RouteValueDictionary(new { controller = "Admin", action = "Finance" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/admin/partners/page{page}",
            new RouteValueDictionary(new { controller = "Admin", action = "Partners" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/admin/editpartner/{id}",
            new RouteValueDictionary(new { controller = "Admin", action = "FormPartner" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/admin/editproduct/{id}",
            new RouteValueDictionary(new { controller = "Admin", action = "FormProduct" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            //Cabinet Controller
            context.Routes.Add(null, new LowercaseRoute(
            "my/cabinet/calculations/page{page}",
            new RouteValueDictionary(new { controller = "Cabinet", action = "Calculations" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/cabinet/tickets/page{page}",
            new RouteValueDictionary(new { controller = "Cabinet", action = "Tickets" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/cabinet/kv/page{page}",
            new RouteValueDictionary(new { controller = "Cabinet", action = "Kv" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/cabinet/confirmedtarif/page{page}",
            new RouteValueDictionary(new { controller = "Cabinet", action = "ConfirmedTarif" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));                        
            context.Routes.Add(null, new LowercaseRoute(
            "my/cabinet/ticketsconfirmedtarif/page{page}",
            new RouteValueDictionary(new { controller = "Cabinet", action = "TicketsConfirmedTarif" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            //News Controller
            context.Routes.Add(null, new LowercaseRoute(
            "my/news/category/{id}",
            new RouteValueDictionary(new { controller = "News", action = "Index" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/news/{id}",
            new RouteValueDictionary(new { controller = "News", action = "New" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            //BSO Controller
            context.Routes.Add(null, new LowercaseRoute(
            "my/bso/journal/page{page}",
            new RouteValueDictionary(new { controller = "Bso", action = "Journal" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));            
            context.Routes.Add(null, new LowercaseRoute(
            "my/bso/errors/page{page}",
            new RouteValueDictionary(new { controller = "Bso", action = "Errors" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add(null, new LowercaseRoute(
            "my/bso/card/{id}",
            new RouteValueDictionary(new { controller = "Bso", action = "Card" }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
            context.Routes.Add("MyArea", new LowercaseRoute(
            "my/{controller}/{action}/{id}",
            new RouteValueDictionary(new { controller = "My", action = "Index", id = UrlParameter.Optional }),
            new RouteValueDictionary(),
            new RouteValueDictionary(new { Namespaces = new[] { "ABC.Controllers.Areas.My" }, area = "my", UseNamespaceFallback = false }),
            new MvcRouteHandler()
            ));
        }
    }
}
